package com.hhsjtest.composiable.scroll;

import android.util.Log;

public class ScrollStateUtil {
    public static final int SCROLL_UP = 1;
    public static final int SCROLL_DOWN = -1;
    public static final int SCROLL_STAY = 0;


    public static final int TOP_ABOVE = 1;
    public static final int TOP_BELOW = -1;
    public static final int TOP = 0;

    public static int listViewPosition(int scrollViewScrollY, int listViewY) {
        if (scrollViewScrollY == listViewY) {
            return TOP;
        } else if (scrollViewScrollY < listViewY) {
            return TOP_BELOW;
        } else {
            return TOP_ABOVE;
        }
    }


    public static int scrollMode(int current, int last) {
        if (current == last) {
            Log.e("HHSJ", "==== 不动 ====");
            return SCROLL_STAY;
        } else if (current > last) {
            Log.e("HHSJ", "==== 下拉 ====");
            return SCROLL_DOWN;
        } else {
            Log.e("HHSJ", "==== 上拉 ====");
            return SCROLL_UP;
        }
    }

    public static String scrollModeName(int mode) {
        if (mode == 0) {
            return "==== 不动 ====";
        } else if (mode == -1) {
            return "==== 下拉 ====";
        } else {
            return "==== 上拉 ====";
        }
    }
}
